<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_log')->create('log_mtg_hot_search_data', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('小程序-热搜数据');

            $table->increments('id');
            $table->integer('stat_date')->comment('哪天的热搜')->unsigned()->default(0);
            $table->string('media_name', 16)->comment('媒体名称')->default('');
            $table->string('title', 256)->comment('标题')->default('');
            $table->string('desc', 1024)->comment('详情')->default('');
            $table->string('url', 1024)->comment('详情url')->default('');
            $table->string('img', 1024)->comment('图片地址')->default('');
            $table->integer('hot_index')->comment('热度排名')->unsigned()->default(0);
            $table->integer('hot_value')->comment('热度值')->unsigned()->default(0);
            $table->tinyInteger('is_top')->comment('是否顶置')->unsigned()->default(0);

            $table->index('stat_date');
            $table->index('media_name');
            $table->index('title');
            $table->index('hot_index');
            $table->index('hot_value');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_log')->dropIfExists('log_mtg_hot_search_data');
    }
};
